package com.sunwayhorizo.health.business.patad.encounter;

import java.util.List;
import java.util.Map;

import javax.ejb.Local;

import com.sunwayhorizo.health.business.dto.PageDTO;
import com.sunwayhorizo.health.business.dto.ResultsDTO;
import com.sunwayhorizo.health.business.dto.patad.encounter.PatientEncounterDTO;
import com.sunwayhorizo.health.business.dto.registries.ThreeLevelsPhysicianDTO;
import com.sunwayhorizo.health.hl7.common.Hl7Exception;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.rim.Document;
import com.sunwayhorizo.health.hl7.rim.Employee;
import com.sunwayhorizo.health.hl7.rim.PatientEncounter;

@Local
public interface ReceivingManagerLocal
{

    /**
     * 患�?入科
     * 
     * @Title: newReceiving
     * @param @param patientEncounterDTO 患�?就诊DTO与前台VO对应
     * @return ResultsDTO 保存成功返回ResultsDTO
     * @throws Hl7Exception
     * @firstAuthor jinzw
     * @firstTime 2010-12-15 下午03:23:15
     * @lastAuthor jinzw
     * @lastTime 2010-12-20 下午01:50:04
     */
    public ResultsDTO newReceiving(PatientEncounterDTO patientEncounterDTO) throws Hl7Exception;


    /**
     * 患�?接诊
     * 
     * @Title: newReceivingAdmit
     * @param @param patientEncounterDTO 患�?就诊DTO与前台VO对应
     * @return ResultsDTO 保存成功返回ResultsDTO
     * @throws Hl7Exception
     * @firstAuthor jinzw
     * @firstTime 2010-12-15 下午03:23:15
     * @lastAuthor jinzw
     * @lastTime 2010-12-20 下午01:50:04
     */
    public ResultsDTO newReceivingAdmit(PatientEncounterDTO patientEncounterDTO) throws Hl7Exception;


    // public ResultsDTO findReceivingClinicalList(String encounterType,String
    // deptId,String empId) throws Hl7Exception;

    /**
     * 住院接诊查询�?��患�?
     * 
     * @Title: findAdmitReceivingList
     * @param workGroupIds
     *            工作组角色ID 为空的时候查询全院待接诊的患�?
     * @param encounterType
     *            此方法就诊类型为入科
     * @return ResultsDTO 保存成功返回ResultsDTO
     * @throws Hl7Exception
     * @firstAuthor jinzw
     * @firstTime 2010-12-15 下午03:23:15
     * @lastAuthor Obama
     * @lastTime 2011-04-08 下午01:50:04
     */

    /**
     * 根据接诊动作获得入院、入科动�?
     * 
     * @Title: findEncountersByRecieveEncounter
     * @param recieveEncounter
     *            接诊动作
     * @return Map<String, PatientEncounter> 入院、入科动�?
     * @throws Hl7Exception
     * @firstAuthor Obama
     * @firstTime 2011-04-07 11:23:15
     * @lastAuthor Obama
     * @lastTime 2011-04-07 13:50:04
     */
    Map<CS, PatientEncounter> findEncountersByRecieveEncounter(PatientEncounter recieveEncounter) throws Hl7Exception;


    PatientEncounterDTO findByRecieveEncounter(PatientEncounter recieveEncounter) throws Hl7Exception;


    PatientEncounterDTO convertIndepartement(PatientEncounterDTO dto, PatientEncounter encounter) throws Hl7Exception;


    /**
     * 住院接诊查询�?��患�?
     * 
     * @Title: findAdmitReceivingList
     * @param workGroupIds
     *            工作组角色ID 为空的时候查询全院待接诊的患�?
     * @param encounterType
     *            此方法就诊类型为就诊
     * @return ResultsDTO 保存成功返回ResultsDTO
     * @throws Hl7Exception
     * @firstAuthor Obama
     * @firstTime 2011-04-08 11:23:15
     * @lastAuthor Obama
     * @lastTime 2011-04-08 11:50:04
     */

    String getEmrCodeByRecievingEncounter(PatientEncounter encounter) throws Hl7Exception;


    PatientEncounterDTO converByIndepartment(PatientEncounter p) throws Hl7Exception;


    ResultsDTO updateDoctorByPatientId(String id, Employee emp) throws Hl7Exception;


    List<PatientEncounterDTO> findPatientsByWorkGroupId(String workgroupId, PageDTO dto) throws Hl7Exception;


    /**
     * 
     * @param workgroupId
     * @param dto
     * @return
     * @throws Hl7Exception
     */
    ResultsDTO findPatientsByWorkgroupId(String workgroupId, PageDTO dto) throws Hl7Exception;


    /**
     * 
     * @param workgroupRoleId
     * @param statusCode
     * @param pageDTO
     * @param patientName
     * @return
     * @throws Hl7Exception
     */
    ResultsDTO findAdmitReceivingListByWorkgroupIds(String workgroupRoleId, List<String> statusCode, PageDTO pageDTO)
        throws Hl7Exception;

    /**
     * 
     * @param workgroupId
     * @param pageDTO
     * @param patientName
     * @return
     * @throws Hl7Exception
     */
    ResultsDTO findAdmitReceivingList(String workgroupId, PageDTO pageDTO) throws Hl7Exception;


    /**
     * 
     * @param roleId
     * @param pageDTO
     * @param patientName
     * @return
     * @throws Hl7Exception
     */

    ResultsDTO findPatientsByDoctor(String roleId, PageDTO pageDTO) throws Hl7Exception;


    /**
     * 
     * @param roleId
     * @param statusCode
     * @param pageDTO
     * @param patientName
     * @return
     * @throws Hl7Exception
     */
    ResultsDTO findPatientsByDoctor(String roleId, List<String> statusCode, PageDTO pageDTO) throws Hl7Exception;


    ResultsDTO findAdmitReceivingListByWorkgroupIds(String workgroupRoleId, PageDTO pageDTO) throws Hl7Exception;


    ResultsDTO update3Levels(ThreeLevelsPhysicianDTO dto) throws Hl7Exception;


    ResultsDTO findPatientsByPatientId(String patientId) throws Hl7Exception;


    PatientEncounter getNewReceiving(String patientId, Document doc) throws Hl7Exception;


    // 打回的上次病历还原

    void returnLastRemove(String patientId, Document doc) throws Hl7Exception;

    /**
     * 组装接诊三级医生
     * @param recieveEncounter
     * @param dto
     * @return
     * @throws Hl7Exception
     */
    PatientEncounterDTO convertRecieveEncounter(PatientEncounter recieveEncounter, PatientEncounterDTO dto) throws Hl7Exception;


  
}
